package com.xx.doublexchat.common.chat.controller;


import com.xx.doublexchat.common.chat.domain.entity.ChatRoomResponse;
import com.xx.doublexchat.common.chat.service.RoomAppService;
import com.xx.doublexchat.common.common.domain.vo.request.CursorPageBaseRequest;
import com.xx.doublexchat.common.common.domain.vo.response.ApiResult;
import com.xx.doublexchat.common.common.domain.vo.response.CursorPageBaseResponse;
import com.xx.doublexchat.common.common.utils.RequestHolder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

import javax.validation.Valid;

/**
 * <p>
 * 会话列表 前端控制器
 * </p>
 *
 * @author xiaoXuan
 * @since 2024-02-29
 */
@Controller
@RequestMapping("/capi/chat")
@Api(tags = "聊天室相关接口")
@Slf4j
public class ContactController {
    @Autowired
    private RoomAppService roomService;
    @GetMapping("/public/contact/page")
    @ApiOperation("会话列表")
    public ApiResult<CursorPageBaseResponse<ChatRoomResponse>> getRoomPage(@Valid CursorPageBaseRequest request) {
        Long uid = RequestHolder.get().getUid();
        return ApiResult.success(roomService.getContactPage(request, uid));
    }
}

